Repository navigation
Let the caller pick the extractor, and read WET files as a source - #87
Merged
Merged
Conversation
markdown export hardcoded h2m with trafilatura in FavorRecall mode. Which extractor you use is a corpus quality decision, not a build time constant: the same shard through two engines is two different corpora, and the only way to find out which one suits a downstream task is to build both and compare. --extractor takes h2m, readability, raw, or wet. The readability engine was already written, sitting in markdown_bench_test.go where nothing but the benchmark could reach it, so it moved into ccrawl/extractor.go next to the others. raw renders the whole document with no extraction at all, which sounds useless and is not: every extractor is a lossy judgement about what a page was for, and raw is the control you measure that judgement against. wet is a different kind of source. Common Crawl already extracted text into the WET files, pkg/wet has read them since v0.4.0, and no pipeline published them. --source-kind picks the manifest, defaults to whatever the extractor needs, and refuses a pairing that cannot work rather than silently reinterpreting the run. A WET file holds no HTML and a WARC holds no pre-extracted text. Every row now carries an extractor column as name@version, and the dataset card names the engine in its processing steps. The version is the part that matters: extraction changes between releases, and a dataset that only records "h2m" cannot explain why two shards built months apart disagree about the same page. The WET text is Common Crawl's own with no version of ours to record, so it is stamped with the crawl instead. Measured on shard 0 of CC-MAIN-2026-30, the same 3.5 GB of HTML each time: h2m 20861 rows 91.9 MB md 1m49s readability 20666 rows 108.5 MB md 1m58s raw 20806 rows 446.2 MB md 2m55s wet 21165 rows 161.9 MB md 15s 20353 documents are in all three WARC engines, 97.6 percent of what h2m produced, and of the ones h2m and readability share only 284 have byte identical text. The row counts differ because an engine that extracts nothing skips the page rather than writing an empty row, and the engines do not give up on quite the same pages. Two things fixed on the way past. The refetch flag checks ran after the manifest download, so a rejected flag combination cost a round trip first; they run before anything is fetched now. And the source-kind mismatch error started with a flag name, which the error renderer title-cases into "Source-Kind", so it is worded from the extractor instead. Closes #49
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49.
markdown exporthardcoded h2m with trafilatura in FavorRecall mode. Which extractor you use is a corpus quality decision, not a build time constant, so it is a flag now.What changed
--extractor h2m|readability|raw|wetonmarkdown export, and the three WARC engines onmarkdown refetch. The readability engine was already written and stranded inmarkdown_bench_test.gowhere only the benchmark could reach it, so it moved intoccrawl/extractor.gonext to the others.rawrenders the whole document with no extraction at all, which is the control corpus: every extractor is a lossy judgement about what a page was for, and the output alone never says where that judgement went wrong.--source-kind warc|wetpicks the manifest. It defaults to whatever the extractor needs, so it rarely has to be given, and a pairing that cannot work is a usage error rather than a silently reinterpreted run. A WET file holds no HTML and a WARC holds no pre-extracted text.wetonrefetchis rejected too: a live fetch returns HTML, and there is no Common Crawl text to pass through.Rows carry a new
extractorcolumn asname@version, and the dataset card names the engine in its processing steps. The version is the part that matters, since extraction changes between releases and a dataset that only recordsh2mcannot explain why two shards built months apart disagree about the same page. The WET text has no version of ours to record, so it is stamped with the crawl aswet@CC-MAIN-2026-30.open-markdown-v3 now has three appended columns (
language,language_confidence,extractor) and changes nothing else, so a v2 reader is unaffected.Done when
Real data
Shard 0 of
CC-MAIN-2026-30, the same 3.5 GB of HTML through each engine on the same machine:h2mreadabilityrawwet20353 documents are in all three WARC engines, 97.6 percent of what
h2mproduced, and of the documentsh2mandreadabilityshare only 284 have byte identical text. So the first box holds with one honest caveat worth stating rather than hiding: the doc_id sets are not exactly identical, because an engine that extracts nothing from a page skips it instead of writing an empty row, and the engines do not give up on quite the same pages. Row counts reproduced exactly across two runs of the same shard.rawproduces roughly five times the text ofh2mfrom the same pages, which is a fair measure of how much of a web page is not the page.wetis in a different cost class, and it is also somebody else's extraction decision, boilerplate included, in plain text rather than Markdown.Fixed on the way past
The refetch flag checks ran after the manifest download, so a rejected flag combination cost a network round trip before it was rejected. They run before anything is fetched now. And the source-kind mismatch error started with a flag name, which the error renderer title-cases into
Source-Kind, so it is worded from the extractor instead.Gates
gofmt -l .,go vet ./...,go test ./...,golangci-lint run(0 issues),./scripts/docs-drift.sh(reference matches the binary).